package Test07;

//多线程常用方法

/*
final void setDaemon(boolean on)    设置为守护线程
 */
public class Test06 {
    public static void main(String[] args) {

        //1、创建线程对象
        MyThread061 t1 = new MyThread061();
        MyThread062 t2 = new MyThread062();

        //2、设置名字
        t1.setName("女神");
        t2.setName("备胎");

        //3、把第二个线程设置成守护线程
        t2.setDaemon(true);

        //4、启动线程
        t1.start();
        t2.start();
    }
}

class MyThread061 extends Thread {

    @Override
    public void run() {
        for (int i = 1; i <= 10; i++) {
            System.out.println(getName() + "@" + i);
        }
    }
}

class MyThread062 extends Thread {

    @Override
    public void run() {
        for (int i = 1; i <= 100; i++) {
            System.out.println(getName() + "@" + i);
        }
    }
}
